import React ,{Suspense}from 'react'
import {BrowserRouter,Route,Routes,Navigate} from 'react-router-dom'
import config from './config'
interface ly{
    path?:string,
    to?:string,
    component?:any,
    children?:ly[]
}
export default function vie() {
    const btn=(arr:ly[])=>{
        return arr.map((a,b)=>{
            return <Route key={b} path={a.path} 
            element={a.to?<Navigate to={a.to}></Navigate>:<a.component></a.component>}>
                {a.children&&btn(a.children)}
            </Route>
        })
    }
  return (
    <BrowserRouter>vie
    <Suspense fallback='加载'>
        <Routes>
        {btn(config)}
        </Routes>
    </Suspense>
    </BrowserRouter>
  )
}
